{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.insert(0,'/home/csunix/schtmt/NewFolder/caffe_Sep/python')\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import caffe\n",
    "#% matplotlib inline#THIS LINE HAS ERROR -> USE THE FOLLOWING 2 LINES\n",
    "# from IPython import get_ipython\n",
    "# get_ipython().run_line_magic('matplotlib', 'inline')\n",
    "\n",
    "caffe.set_device(0)\n",
    "caffe.set_mode_gpu()\n",
    "solver = caffe.SGDSolver('ucsd_conv_lstm_relu_Sep_solver.prototxt')\n",
    "solver.net.copy_from('/usr/not-backed-up/1_convlstm/ucsd_conv_lstm_Sep/iter_iter_6000.caffemodel')\n",
    "niter = 6000000\n",
    "recons_loss = np.zeros(niter)\n",
    "predict_loss = np.zeros(niter)\n",
    "for i in range(niter):\n",
    "    solver.step(1)\n",
    "    #print solver.net.blobs.keys()\n",
    "    #     train_loss[i] = solver.net.blobs['l2_error'].data\n",
    "    loss1 = solver.net.blobs['recons_error'].data\n",
    "    loss2 = solver.net.blobs['predict_error'].data\n",
    "    # if (i%100 == 0):\n",
    "    #     print('iteration', i, ':cross-entropy-loss', loss)\n",
    "    recons_loss[i] = loss1\n",
    "    predict_loss[i] = loss2\n",
    "    np.save('reconstruction_error',recons_loss)\n",
    "    np.save('prediction_error',predict_loss)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
